#

| Chapter 35 You Can't Quite Call This Editing |

## 35.15 Cutting Columns with colrm

BSD's (somewhat limited) alternative to cut (35.14) is colrm.

It can cut only by column position, not by field. All you have to give it is a starting column position and an optional ending position. The text is read from standard input. (colrm can't read files directly; redirect input with `<` or `|` (13.1).)

If you give just one column number, all columns from that position to the end of the line are removed. With two column number arguments, all columns between the starting column position and the ending position, inclusive, are removed.

The following command outputs just the permissions (columns 1 to 10) and filenames (columns 45 to the end of the line, including the space before names) from fixed-width ls -l output (22.2). (Some versions of ls -l adjust column widths. If yours does, colrm and cut won't help; try awk (33.11).)

>     % ls -l | colrm 11 44
>     drwxr-xr-x manpages
>     -rw-r--r-- misc.Z
>     -rwxr-xr-x myhead

The following command will remove the remote hostname, if any, that starts at column 33 of who (51.4) output:

>     % who | colrm 33

- JP, TOR

35.14 Cutting Columns or Fields with cut |  | 35.16 Make Columns Automatically with cols